import axios from 'axios'
import { baseURL } from './api.js'

export const sendActionPOST=(url,data)=>{
    return new Promise((resolve,reject)=>{
        axios.request({
            method:"POST",
            url:baseURL+url,
            data,
            withCredentials:true
        }).then((res)=>{
            resolve(res)
        }).catch((err)=>{
            reject(err)
        })
    })
}

export const sendActionGet=(url,data='')=>{
    return new Promise((resolve,reject)=>{
        axios.request({
            method:"GET",
            url:baseURL+url,
            data,
            withCredentials:true
        }).then((res)=>{
            resolve(res)
        }).catch((err)=>{
            reject(err)
        })
    })
}